package com.ykdl.member.http;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.net.wifi.WifiManager;

import com.ykdl.member.KidApp;

public class HttpUtil {
	public static String getProxy() {
		WifiManager wifiManager = (WifiManager) KidApp
				.getInstance().getSystemService(Context.WIFI_SERVICE);
		if (!wifiManager.isWifiEnabled()) {
			// 获取当前正在使用的APN接入点
			Uri uri = Uri.parse("content://telephony/carriers/preferapn");
			Cursor mCursor = KidApp.getInstance()
					.getContentResolver().query(uri, null, null, null, null);
			if (mCursor != null && mCursor.moveToFirst()) {
				// 游标移至第一条记录，当然也只有一条
				String proxyStr = mCursor.getString(mCursor
						.getColumnIndex("proxy"));
				if (proxyStr != null && proxyStr.trim().length() > 0) {
					return proxyStr;
				}
			}
		}
		return null;
	}
}
